package com.shujia.wyh.day28;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class InvocationHandlerImpl implements InvocationHandler {
    private Object proxy1; //目标对象。将来你要给谁去代理实现功能

    InvocationHandlerImpl(Object proxy1) {
        this.proxy1 = proxy1;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("权限校验");
        Object o = method.invoke(proxy1, args);
        System.out.println("日志记录");
        return o;
    }
}
